<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>我的快递</title>
		<link rel="stylesheet" type="text/css" href="css/personCenterPublic.css"/>
		<link rel="stylesheet" type="text/css" href="css/express.css"/>
		<script src="js/jquery-2.1.0.js"></script>
		<script>
			$(function(){

				$.ajax("/fengwei/express/showExpress",{
					type:"get",
					data:{},
					success:function(data){
						var dataObj = eval('('+data+')');
						console.log(dataObj);
						setData(dataObj);
					},
					error:function(){
						console.log(0);
					}
				});

				function setData(dataObj){

					var content = document.getElementById('content');
					for(var i = 0;i<dataObj.length;i++){
						var arr = dataObj[i].fileUrl.split("\\");
						var src = arr[arr.length-2]+"/"+arr[arr.length-1];
						var goodsIntroducts = dataObj[i].goodsIntroducts;
						var goodsCity = dataObj[i].goodsCity;
						var goodsAdress = dataObj[i].goodsAdress;
						var goodsorderCount = dataObj[i].goodsorderCount;
						var goodsorderPrice = dataObj[i].goodsorderPrice;

						var newDiv = document.createElement("div");
						newDiv.setAttribute('class','each');
						content.appendChild(newDiv);

						newDiv.innerHTML = "<div class='eachCon'>"+
						"<img src="+src+"/>"+
						"<p class='goodsName'>"+goodsIntroducts+"</p>"+
						"<span class='producePlace'>产地："+goodsCity+"</span>"+
						"<span class='desPlace'>目的地："+goodsAdress+"</span>"+
						"<span class='amount'>数量："+goodsorderCount+"</span>"+
						"<span class='price'>价格："+goodsorderPrice+"</span>"+
						"</div>"+
						"<input type='button' name='see' class='see' value='查看物流' />"+
						"<input type='button' name='confirm' class='confirm' value='确认收货' />"


						var see = document.getElementsByClassName("see");
						var confirm = document.getElementsByClassName("confirm");

						see[i].index = i;
						see[i].onclick = function(){

							var count = this.index;
							window.location.href = "expressStatus.html?id="+dataObj[count].goodsorderId+"";
						};

						confirm[i].index = i;
						confirm[i].onclick = function(){
							var count = this.index;
							window.location.href = "comment.html?id="+dataObj[count].goodsorderId+"";
						};

//						$('.confirm').click(function(){
//
//						})

					}
				}

			})
		</script>
	</head>
	<body>
	<div id="back">
			<a href="#" onClick="javascript :history.back(-1);"><&nbsp;返回个人中心</a>
		</div>
		<div id="content">

		</div>
	</body>
</html>
